/*
 * DiTAA - Diagrams Through Ascii Art
 * 
 * Copyright (C) 2004 Efstathios Sideris
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *   
 */
package io.noties.markwon.plugin.typogram.bean

/**
 *
 * @author Efstathios Sideris
 */
class AbstractCell {
    var rows = Array(3) { IntArray(3) }

    init {
        for (y in 0..2)
            for (x in 0..2)
                rows[x][y] = 0
    }

    companion object {
        fun makeHorizontalLine(): AbstractCell {
            val result = AbstractCell()
            result.rows[0][1] = 1
            result.rows[1][1] = 1
            result.rows[2][1] = 1
            return result
        }

        fun makeVerticalLine(): AbstractCell {
            val result = AbstractCell()
            result.rows[1][0] = 1
            result.rows[1][1] = 1
            result.rows[1][2] = 1
            return result
        }

        fun makeCorner1(): AbstractCell {
            val result = AbstractCell()
            result.rows[1][1] = 1
            result.rows[1][2] = 1
            result.rows[2][1] = 1
            return result
        }

        fun makeCorner2(): AbstractCell {
            val result = AbstractCell()
            result.rows[0][1] = 1
            result.rows[1][1] = 1
            result.rows[1][2] = 1
            return result
        }

        fun makeCorner3(): AbstractCell {
            val result = AbstractCell()
            result.rows[0][1] = 1
            result.rows[1][1] = 1
            result.rows[1][0] = 1
            return result
        }

        fun makeCorner4(): AbstractCell {
            val result = AbstractCell()
            result.rows[2][1] = 1
            result.rows[1][1] = 1
            result.rows[1][0] = 1
            return result
        }

        fun makeT(): AbstractCell {
            val result = makeHorizontalLine()
            result.rows[1][2] = 1
            return result
        }

        fun makeInverseT(): AbstractCell {
            val result = makeHorizontalLine()
            result.rows[1][0] = 1
            return result
        }

        fun makeK(): AbstractCell {
            val result = makeVerticalLine()
            result.rows[2][1] = 1
            return result
        }

        fun makeInverseK(): AbstractCell {
            val result = makeVerticalLine()
            result.rows[0][1] = 1
            return result
        }

        fun makeCross(): AbstractCell {
            val result = makeVerticalLine()
            result.rows[0][1] = 1
            result.rows[2][1] = 1
            return result
        }

        fun makeStar(): AbstractCell {
            val result = makeVerticalLine()
            for (y in 0..2)
                for (x in 0..2)
                    result.rows[x][y] = 1
            return result
        }
    }
}